<template>
  <div class="total">
    <div class="left">
      <!-- 输入内容 -->
      <div class="ltop">
        <el-input
          v-model="input"
          placeholder="请输入内容"
          style="margin: 0; padding: 0"
        ></el-input>
      </div>
      <!-- 学生列表 -->
      <div class="lbottom">
        <el-table
          :data="stuList"
          @row-click="chooseStu"
          :header-cell-style="{
            'text-align': 'left',
            'padding-left': '6px',
            cursor: 'pointer' /*小手样式 */,
          }"
          :cell-style="{
            'text-align': 'left',
            'padding-left': '6px',
            cursor: 'pointer' /*小手样式 */,
          }"
          @header-click="fun"
          style="width: 100%"
        >
          <el-table-column label="新增方案" width="170">
            <template slot-scope="scope">{{
              scope.row.name + "方案"
            }}</template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <div class="right">
      <!-- 学生信息 -->
      <div class="rtop">
        <span
          >省份: &nbsp;{{
            this.curStuInfo.province
          }}&nbsp;&nbsp;|&nbsp;&nbsp;</span
        >
        <span
          >姓名:&nbsp;{{ this.curStuInfo.name }}&nbsp;&nbsp;|&nbsp;&nbsp;</span
        >
        <span
          >分数:&nbsp;{{ this.curStuInfo.score }}&nbsp;&nbsp;|&nbsp;&nbsp;</span
        >
        <span
          >排名:&nbsp;{{
            this.curStuInfo.ranking
          }}&nbsp;&nbsp;|&nbsp;&nbsp;</span
        >
        <span>选科:&nbsp;{{ this.curStuInfo.selectiveCombination }}&nbsp;</span>
        <span style="margin-left: 100px">本科</span>
      </div>
      <!-- 初选志愿 -->
      <div class="rmid1">
        <span class="hr-more1">初选志愿</span>
        <!-- 初选志愿--偏差分值信息 -->
        <div class="topcontent">
          <span>冲稳保偏差分值&nbsp;</span>
          <el-input-number
            v-model="diffScore"
            style="width: 80px"
            controls-position="right"
            @change="handleChange"
            :min="1"
            :max="10"
          ></el-input-number>
          <span
            >&nbsp;(建议偏差分差分值设为5：预测分加偏差分≥
            <h3
              style="
                display: inline;
                color: red;
                font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman',
                  serif;
              "
            >
              冲
            </h3>
            >预测分，预测分≥
            <h3
              style="
                display: inline;
                color: red;
                font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman',
                  serif;
              "
            >
              稳
            </h3>
            ≥预测分减偏差分，预测分减偏差分>
            <h3
              style="
                display: inline;
                color: red;
                font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman',
                  serif;
              "
            >
              保
            </h3>
            ≥预测分减2倍偏差分)
          </span>
        </div>
        <!-- 初选志愿--筛选条件 -->
        <div class="midcontent">
          <span style="width: 90px">筛选条件:</span>
          <div
            class="zdy"
            placeholder=""
            style="
              text-align: left;
              padding-top: 8px;
              width: 90%;
              min-height: 40px;
              max-height: 80px;
              padding-right: 5px;
              overflow: auto;
            "
            @click="openconditiondiv()"
          >
            <el-tag
              v-for="tag in tags"
              :key="tag.name"
              closable
              :type="tag.type"
              :disable-transitions="false"
              @close="handleCloseTag(tag)"
            >
              {{ tag.name }}
            </el-tag>
          </div>
          <el-button
            type="warning"
            style="width: 90px; margin-left: 10px"
            @click="resetMajor()"
            >重置</el-button
          >
        </div>
        <hr
          style="
            width: 85%;
            margin-top: 20px;
            border: 5px solid rgb(226, 226, 221);
          "
        />
        <!-- 初选志愿--筛选方案总体信息 -->
        <div class="bottomcontent">
          <span
            >初选{{
              this.curShowRisk[0] + this.curShowRisk[1] + this.curShowRisk[2]
            }}条记录，其中冲一冲{{ this.curShowRisk[0] }}条，稳一稳{{
              this.curShowRisk[1]
            }}条，保一保{{ this.curShowRisk[2] }}条</span
          >
          <el-button
            @click="searchAndSave()"
            style="
              width: 80px;
              margin-left: 7%;
              text-align: center;
              padding: 0;
              padding-top: 10px;
              padding-bottom: 10px;
            "
            >保存方案</el-button
          >
          <span
            >&nbsp;(初选记录介于100与300条之间方可保存，最多保存3份方案)</span
          >
        </div>
      </div>

      <hr
        style="
          border: 2px solid rgb(226, 226, 221);
          margin-left: 6%;
          margin-right: 6%;
          margin-top: 2%;
        "
      />
      <span class="hr-more2">优化志愿</span>
      <!-- 优化志愿 -->
      <div class="rmid2">
        <!-- 优化志愿--方案总体信息表格 -->
        <el-table
          :data="caseRecords"
          :show-header="false"
          style="width: 100%"
          v-show="caseshow"
        >
          <el-table-column prop="name" label="方案" width="60">
          </el-table-column>
          <el-table-column label="方案记录信息" width="240">
            <template slot-scope="scope"
              >{{
                scope.row.riskList[0] +
                scope.row.riskList[1] +
                scope.row.riskList[2]
              }}条记录，冲 {{ scope.row.riskList[0] }}

              ，稳 {{ scope.row.riskList[1] }}

              ,保{{ scope.row.riskList[2] }}
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            width="550px"
            style="white-space: nowrap"
          >
            <template slot-scope="scope">
              <div class="updBtn" style="display: inline-block">
                <el-button
                  @click="updateCase(scope.row)"
                  plain
                  size="small"
                  icon="el-icon-edit"
                  >优化</el-button
                >
              </div>
              <div class="delBtn" style="display: inline-block">
                <el-button
                  @click="deleteCase(scope.row)"
                  type="danger"
                  plain
                  size="small"
                  icon="el-icon-delete"
                  >删除</el-button
                >
              </div>
              <div class="delBtn" style="display: inline-block">
                <el-button
                  @click="openaddcasediv(scope.row)"
                  plain
                  size="small"
                  icon="el-icon-circle-plus-outline"
                  >新增记录</el-button
                >
              </div>
              <div class="delBtn" style="display: inline-block">
                <el-button
                  @click="exportCase(scope.row)"
                  plain
                  size="small"
                  icon="el-icon-download"
                  >导出</el-button
                >
              </div>
              <span>(满足96条记录方可导出)</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 方案详情 -->
      <div class="rbottom" v-loading="caseInfoLoad">
        <span class="hr-more3">方案详情</span>
        <!-- 方案详情--方案志愿记录表格 -->
        <el-table
          v-show="caseRecordsInfoshow"
          v-horizontal-scroll="'always'"
          :data="caseRecordsInfo"
          :default-sort="{ prop: 'ranking', order: 'ascending' }"
          :header-cell-style="{
            'text-align': 'center',
          }"
          :cell-style="setRowStyle"
          :row-style="{ height: '20px' }"
          border
          style="width: 100%; height: 92%; overflow: auto"
        >
          <el-table-column label="序号" width="60">
            <template slot-scope="scope">{{
              "志愿" + scope.row.ranking
            }}</template>
          </el-table-column>
          <el-table-column prop="risk" label="定位" width="60">
          </el-table-column>
          <el-table-column prop="institutionCode" label="院校代码" width="80">
          </el-table-column>
          <el-table-column prop="institutionName" label="院校名称" width="120">
          </el-table-column>
          <el-table-column prop="majorCode" label="专业代码" width="80">
          </el-table-column>
          <el-table-column
            label="专业名称"
            width="160"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="{ row }">
              <span>{{ row.majorName }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="tuitionFee" label="学费" width="80">
          </el-table-column>
          <el-table-column prop="enrollmentPlan" label="招生人数" width="80">
          </el-table-column>
          <el-table-column
            prop="thisYearReferenceScore"
            label="2023参照分"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="pastFirstLowestScore"
            label="22最低分"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="pastFirstLowestRank"
            label="22最低位次"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="pastSecondLowestScore"
            label="21最低分"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="pastSecondLowestRank"
            label="21最低位次"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="pastThirdLowestScore"
            label="20最低分"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="pastThirdLowestRank"
            label="20最低位次"
            width="100"
          >
          </el-table-column>
          <el-table-column
            label="操作"
            width="220px"
            style="white-space: nowrap"
          >
            <template slot-scope="scope">
              <div
                class="delBtn"
                style="display: inline-block"
                ref="closePopover"
              >
                <el-button
                  @click="deleteCaseInfo(scope.row)"
                  type="danger"
                  plain
                  size="small"
                  icon="el-icon-delete"
                  >删除</el-button
                >
              </div>
              <div class="delBtn" style="display: inline-block">
                <el-popover
                  placement="right"
                  width="400"
                  trigger="click"
                  style="position: relative"
                >
                  <el-descriptions
                    class="margin-top"
                    :column="1"
                    border
                    style="width: 320px"
                  >
                    <el-descriptions-item>
                      <template slot="label">
                        <i class="el-icon-location-outline"></i>
                        当前位次
                      </template>
                      &nbsp;&nbsp;&nbsp;{{ curOrder }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                      <template slot="label">
                        <i class="el-icon-location-outline"></i>
                        新位次
                      </template>
                      <el-input
                        v-model="newOrder"
                        placeholder="请输入新位次"
                        oninput="value=value.replace(/[^0-9.]/g,'')"
                      ></el-input>
                    </el-descriptions-item>
                  </el-descriptions>
                  <el-button
                    @click="changeOrder(scope.row)"
                    plain
                    size="small"
                    icon="el-icon-edit"
                    style="position: absolute; bottom: 12%; right: 3%"
                    >确定</el-button
                  >
                  <el-button
                    slot="reference"
                    @click="changeOrderAlert(scope.row)"
                    plain
                    size="small"
                    icon="el-icon-edit"
                    >调整位次</el-button
                  >
                </el-popover>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 高级筛选对话框 -->
      <el-dialog
        title="筛选条件"
        :visible.sync="conditiondivshow"
        :before-close="handleClose"
      >
        <span slot="footer" class="dialog-footer">
          <el-button @click="conditiondivshow = false">取 消</el-button>
          <el-button type="primary" @click="majorConfirm()">确 定</el-button>
        </span>
        <div>
          <div
            class="conditiondiv"
            style="height: 35%; display: flex; justify-content: center"
          >
            <!-- 高级筛选--选择专业 -->
            <div class="conditiondiv1">
              <div class="title">选择专业</div>
              <hr style="border: 2px solid rgb(226, 226, 221)" />
              <el-tabs :tab-position="'left'" style="height: 260px">
                <el-tab-pane label="工学">
                  <div style="padding-left: 10%; margin-top: 2%">
                    <el-checkbox
                      v-model="engineeringCheckAll"
                      @change="handleEngineeringAll"
                      >全选</el-checkbox
                    >
                    <el-checkbox-group v-model="choosedEngineering">
                      <div style="margin-top: 5%">
                        <el-checkbox label="交叉工程类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="力学类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="机械类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="仪器类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="电子信息类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="计算机类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="材料类"></el-checkbox>
                      </div>

                      <!-- <div style="margin-top: 5%">
                  <el-checkbox label="材料类" disabled></el-checkbox>
                </div> -->
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="哲学">
                  <div style="padding-left: 10%">
                    <el-checkbox
                      v-model="philosophyCheckAll"
                      @change="handlePhilosophyAll"
                      >全选</el-checkbox
                    >
                    <el-checkbox-group v-model="choosedPhilosophy">
                      >
                      <div style="margin-top: 5%">
                        <el-checkbox label="哲学1"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="哲学2"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="哲学3"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="哲学4"></el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="经济学">
                  <div style="padding-left: 10%">
                    <el-checkbox
                      v-model="economicsCheckAll"
                      @change="handleEconomicsAll"
                      >全选</el-checkbox
                    >

                    <el-checkbox-group v-model="choosedEconomics">
                      <div style="margin-top: 5%">
                        <el-checkbox label="经济学类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="金融学类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="经济与贸易"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="工商管理类"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="图书情报与档案管理类"></el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="法学">
                  <div style="padding-left: 10%">
                    <el-checkbox v-model="lawCheckAll" @change="handleLawAll"
                      >全选</el-checkbox
                    >
                    <el-checkbox-group v-model="choosedLaw">
                      <div style="margin-top: 5%">
                        <el-checkbox label="法学1"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="法学2"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="法学3"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="法学4"></el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="教育学">
                  <div style="padding-left: 10%">
                    <el-checkbox
                      v-model="teachCheckAll"
                      @change="handleTeachAll"
                      >全选</el-checkbox
                    >
                    <el-checkbox-group v-model="choosedTeach">
                      <div style="margin-top: 5%">
                        <el-checkbox label="教育学1"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="教育学2"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="教育学3"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="教育学4"></el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="文学">
                  <div style="padding-left: 10%">
                    <el-checkbox
                      v-model="literatureCheckAll"
                      @change="handleLiteratureAll"
                      >全选</el-checkbox
                    >
                    <el-checkbox-group v-model="choosedLiterature">
                      <div style="margin-top: 5%">
                        <el-checkbox label="文学1"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="文学2"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="文学3"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="文学4"></el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
              </el-tabs>
              <!-- <div
              class="btn"
              style="margin-top: 13px; margin-left: 20px; white-space: nowrap"
            >
              <el-button type="danger" style="width: 90px" @click="resetMajor()"
                >重置</el-button
              >
              <el-button
                type="primary"
                style="width: 220px"
                @click="majorConfirm()"
                >确定</el-button
              >
            </div> -->
            </div>
            <!-- 高级筛选--选择院校 -->
            <div class="conditiondiv2">
              <div class="title">选择院校</div>
              <hr style="border: 2px solid rgb(226, 226, 221)" />
              <el-tabs :tab-position="'left'" style="height: 250px">
                <el-tab-pane label="院校层次">
                  <div style="padding-left: 10%">
                    <el-checkbox-group
                      v-model="choosedCollegeLeve"
                      @change="collegeConfirm()"
                    >
                      <div style="margin-top: 5%">
                        <el-checkbox label="985/211/双一流"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="211/双一流"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="211"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="双一流"></el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="办学性质">
                  <div style="padding-left: 10%">
                    <el-checkbox-group
                      v-model="choosedCollegeHoldType"
                      @change="collegeConfirm()"
                    >
                      <div style="margin-top: 5%">
                        <el-checkbox label="公办"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="民办"></el-checkbox>
                      </div>
                      <div style="margin-top: 5%">
                        <el-checkbox label="独立学院"></el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="所在省份">
                  <div
                    style="
                      padding-left: 10%;
                      height: 250px;
                      overflow: scroll;
                      overflow-x: hidden;
                    "
                  >
                    <el-checkbox-group
                      v-model="choosedProvince"
                      @change="collegeConfirm()"
                    >
                      <div
                        style="margin-top: 5%"
                        v-for="city in cities"
                        :key="city"
                      >
                        <el-checkbox :label="city">{{ city }}</el-checkbox>
                      </div>
                    </el-checkbox-group>
                  </div>
                </el-tab-pane>
              </el-tabs>
              <!-- <div
              class="btn"
              style="margin-top: 13px; margin-left: 20px; white-space: nowrap"
            >
              <el-button
                type="danger"
                style="width: 90px"
                @click="resetCollege()"
                >重置</el-button
              >
              <el-button
                type="primary"
                style="width: 220px"
                @click="collegeConfirm()"
                >确定</el-button
              >
            </div> -->
            </div>
            <!-- 高级筛选--选择招生类别 -->
            <div class="conditiondiv3">
              <div class="title">选择招生类别</div>
              <hr style="border: 2px solid rgb(226, 226, 221)" />
              <div style="padding-left: 10%">
                <el-checkbox-group
                  v-model="choosedEnrollType"
                  @change="enrollConfirm()"
                >
                  <div style="margin-top: 5%">
                    <el-checkbox label="普通类"></el-checkbox>
                  </div>
                  <div style="margin-top: 5%">
                    <el-checkbox label="地方专项"></el-checkbox>
                  </div>
                  <div style="margin-top: 5%">
                    <el-checkbox label="校企合作"></el-checkbox>
                  </div>
                  <div style="margin-top: 5%">
                    <el-checkbox label="边防子女"></el-checkbox>
                  </div>
                  <!-- <div style="margin-top: 5%">
                  <el-checkbox label="定藏生" ></el-checkbox>
                </div> -->
                </el-checkbox-group>
              </div>
              <!-- <div
              class="btn"
              style="margin-top: 130px; margin-left: 20px; white-space: nowrap"
            >
              <el-button
                type="danger"
                style="width: 90px"
                @click="resetEnroll()"
                >重置</el-button
              >
              <el-button
                type="primary"
                style="width: 220px"
                @click="enrollConfirm()"
                >确定</el-button
              >
            </div> -->
            </div>
            <!-- 高级筛选--其他筛选 -->
            <div class="conditiondiv4" style="margin-right: 1%">
              <div class="title">其他筛选</div>
              <hr style="border: 2px solid rgb(226, 226, 221)" />
              <div style="padding-left: 10%">
                <el-checkbox-group
                  v-model="choosedOther"
                  @change="otherConfirm()"
                >
                  <div style="margin-top: 5%">
                    <el-checkbox label="只选大学"></el-checkbox>
                  </div>
                  <div style="margin-top: 5%">
                    <el-checkbox label="不选外省学院"></el-checkbox>
                  </div>
                  <div style="margin-top: 5%">
                    <el-checkbox label="招生人数大于1人"></el-checkbox>
                  </div>
                  <div style="margin-top: 5%">
                    <el-checkbox label="招生人数大于2人"></el-checkbox>
                  </div>
                  <div style="margin-top: 5%">
                    <el-checkbox label="招生人数大于3人"></el-checkbox>
                  </div>
                </el-checkbox-group>
              </div>
              <!-- <div
              class="btn"
              style="margin-top: 95px; margin-left: 20px; white-space: nowrap"
            >
              <el-button type="danger" style="width: 90px" @click="resetOther()"
                >重置</el-button
              >
              <el-button
                type="primary"
                style="width: 220px"
                @click="otherConfirm()"
                >确定</el-button
              >
            </div> -->
            </div>
          </div>
        </div>
      </el-dialog>
      <!-- 新增志愿记录对话框 -->
      <el-dialog
        title="新增志愿记录"
        :visible.sync="addcasedivshow"
        style="height: 800px; overflow: hidden"
        v-loading="lastCaseInfoLoad"
      >
        <div class="dialogTable" style="height: 500px">
          <el-table
            v-horizontal-scroll="'always'"
            :data="lastcaseRecordsInfo"
            :header-cell-style="{
              'text-align': 'center',
            }"
            :cell-style="setRowStyle"
            :row-style="{ height: '20px' }"
            border
            style="width: 100%; height: 500px; overflow: auto"
          >
            <el-table-column label="序号" width="60">
              <template slot-scope="scope">{{
                "志愿" + scope.row.ranking
              }}</template>
            </el-table-column>
            <el-table-column prop="risk" label="定位" width="60">
            </el-table-column>
            <el-table-column prop="institutionCode" label="院校代码" width="80">
            </el-table-column>
            <el-table-column
              <el-table-column
              prop="institutionName"
              label="院校名称"
              width="120"
            >
            </el-table-column>
            <el-table-column prop="majorCode" label="专业代码" width="80">
            </el-table-column>
            <el-table-column
              label="专业名称"
              width="160"
              :show-overflow-tooltip="true"
            >
              <template slot-scope="{ row }">
                <span>{{ row.majorName }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="tuitionFee" label="学费" width="80">
            </el-table-column>
            <el-table-column prop="enrollmentPlan" label="招生人数" width="80">
            </el-table-column>
            <el-table-column
              prop="thisYearReferenceScore"
              label="2023参照分"
              width="100"
            >
            </el-table-column>
            <el-table-column
              prop="pastFirstLowestScore"
              label="22最低分"
              width="100"
            >
            </el-table-column>
            <el-table-column
              prop="pastFirstLowestRank"
              label="22最低位次"
              width="100"
            >
            </el-table-column>
            <el-table-column
              prop="pastSecondLowestScore"
              label="21最低分"
              width="100"
            >
            </el-table-column>
            <el-table-column
              prop="pastSecondLowestRank"
              label="21最低位次"
              width="100"
            >
            </el-table-column>
            <el-table-column
              prop="pastThirdLowestScore"
              label="20最低分"
              width="100"
            >
            </el-table-column>
            <el-table-column
              prop="pastThirdLowestRank"
              label="20最低位次"
              width="100"
            >
            </el-table-column>
            <el-table-column
              label="操作"
              width="220px"
              style="white-space: nowrap"
            >
              <template slot-scope="scope">
                <div class="addbtn" style="display: inline-block">
                  <el-button
                    @click="addCaseInfoRecord(scope.row)"
                    plain
                    size="small"
                    icon="el-icon-circle-plus-outline"
                    >添加志愿记录</el-button
                  >
                </div>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import {
  allStudentInfo,
  studentInfo,
  saveAndOptimize,
  schemeDelete,
  schemeOptimize,
  recordDelete,
  addNewRecord,
  newRecordSave,
  exportExcel,
} from "../api/college";
export default {
  name: "CollegeApplication",
  data() {
    return {
      changeOrderTable: [],
      tags: [
        // { name: "标签一", type: "" },
        // { name: "标签二", type: "success" },
        // { name: "标签三", type: "info" },
        // { name: "标签四", type: "warning" },
        // { name: "标签五", type: "danger" },
      ],
      conditiondivshow: false,
      addcasedivshow: false,
      caseRecordsInfoshow: false,

      caseInfoLoad: false,
      lastCaseInfoLoad: false,
      caseshow: false,

      input: "",
      diffScore: 5,
      caseRecords: [
        {
          id: "",
          name: "方案1",
          riskList: [],
        },
      ],
      caseRecordsInfo: [], //当前方案志愿记录
      lastcaseRecordsInfo: [], //剩余可添加的方案志愿记录

      //全选是否勾选
      engineeringCheckAll: false,
      philosophyCheckAll: false,
      economicsCheckAll: false,
      lawCheckAll: false,
      teachCheckAll: false,
      literatureCheckAll: false,
      filterCondition: {},
      // 选择专业
      engineeringList: [
        "交叉工程类",
        "力学类",
        "机械类",
        "仪器类",
        "材料类",
        "电子信息类",
        "计算机类",
        "自动化类",
      ],
      choosedEngineering: [],
      choosedEngineeringSet: new Set(),

      philosophyList: ["哲学1", "哲学2", "哲学3", "哲学4"],
      choosedPhilosophy: [],
      choosedPhilosophySet: new Set(),

      economicsList: [
        "经济学类",
        "金融学类",
        "财政学类",
        "经济与贸易",
        "工商管理类",
        "公共管理类",
        "图书情报与档案管理类",
      ],
      choosedEconomics: [],
      choosedEconomicsSet: new Set(),

      lawList: ["法学1", "法学2", "法学3", "法学4"],
      choosedLaw: [],
      choosedLawSet: new Set(),

      teachList: ["教育学1", "教育学2", "教育学3", "教育学4"],
      choosedTeach: [],
      choosedTeachSet: new Set(),

      literatureList: ["文学1", "文学2", "文学3", "文学4"],
      choosedLiterature: [],
      choosedLiteratureSet: new Set(),

      //选择院校
      choosedCollegeLeve: [],
      choosedCollegeLeveSet: new Set(),

      choosedCollegeHoldType: [],
      choosedCollegeHoldTypeSet: new Set(),

      choosedProvince: [],
      choosedProvinceSet: new Set(),

      //选择招生类别
      choosedEnrollType: [],
      choosedEnrollTypeSet: new Set(),

      //其他筛选
      choosedOther: [],
      choosedOtherSet: new Set(),
      cities: [
        "北京市",
        "天津市",
        "上海市",
        "重庆市",
        "河北省",
        "山西省",
        "辽宁省",
        "吉林省",
        "黑龙江省",
        "江苏省",
        "浙江省",
        "安徽省",
        "福建省",
        "江西省",
        "山东省",
        "河南省",
        "湖北省",
        "湖南省",
        "广东省",
        "海南省",
        "四川省",
        "贵州省",
        "云南省",
        "陕西省",
        "甘肃省",
        "青海省",
        "台湾省",
        "内蒙古自治区",
        "广西壮族自治区",
        "西藏自治区",
        "宁夏回族自治区",
        "新疆维吾尔自治区",
        "香港特别行政区",
        "澳门特别行政区",
      ],
      stuList: [], //当前系统所有存在方案的学生信息
      curStuInfo: {}, //当前学生信息
      curCaseList: [], //当前学生的所有方案对应的筛选条件集合
      curRiskList: [], //当前学生对应的所有方案冲稳保数量信息集合
      curShowRisk: [0, 0, 0], //当前展示的冲稳保信息
      curOpeCaseId: 0, //当前操作方案id
      curOrder: "",
      newOrder: "",
    };
  },
  mounted() {
    this.getAllStu();
  },
  methods: {
    setRowStyle(row) {
      // console.log("row",row)
      if (row.columnIndex == 1)
        return 'font-size:22px;color: red;text-align: center;font-weight: bold;font-family: "Lucida Calligraphy", cursive, serif, sans-serif;';
      else {
        return "text-align: center;";
      }
    },
    //获得所有存在志愿方案的学生
    getAllStu() {
      allStudentInfo().then((res) => {
        this.stuList = res.data.data;
        // console.log("this.stuList:", this.stuList);
      });
    },
    //回显第几个案件的筛选条件和冲稳保数量
    reviewCase(curCaseList, curRiskList, idx) {
      if (
        curCaseList != null &&
        curRiskList != null &&
        curCaseList[idx] != null &&
        curRiskList[idx].riskRecordsCount != null &&
        curRiskList[idx].riskRecordsCount.length == 3
      ) {
        // console.log("进入回显...");
        //回显偏差分数
        this.diffScore = curCaseList[idx].scoreBias;
        //回显筛选条件及冲稳保数量
        this.curShowRisk = curRiskList[idx].riskRecordsCount;
        let majorCondition = JSON.parse(curCaseList[idx].majorClass);
        // console.log(
        //   "res.data.data.studentInfoIntentionSchemes[idx].majorClass:",
        //   majorCondition
        // );
        //默认回显该学生第一个方案的信息
        if (majorCondition.engineeringList != null)
          majorCondition.engineeringList.forEach((e) => {
            this.choosedEngineering.push(e);
          });
        if (majorCondition.economicsList != null)
          majorCondition.economicsList.forEach((e) => {
            this.choosedEconomics.push(e);
          });
        if (majorCondition.philosophyList != null)
          majorCondition.philosophyList.forEach((e) => {
            this.choosedPhilosophy.push(e);
          });
        if (majorCondition.lawList != null)
          majorCondition.lawList.forEach((e) => {
            this.choosedLaw.push(e);
          });
        if (majorCondition.teachList != null)
          majorCondition.teachList.forEach((e) => {
            this.choosedTeach.push(e);
          });
        if (majorCondition.literatureList != null)
          majorCondition.literatureList.forEach((e) => {
            this.choosedLiterature.push(e);
          });

        //不使用eval，则字符串数组会被分裂
        eval(curCaseList[0].institutionalLevel).forEach((e) => {
          this.choosedCollegeLeve.push(e);
        });

        eval(curCaseList[0].schoolProperty).forEach((e) => {
          this.choosedCollegeHoldType.push(e);
        });

        eval(curCaseList[0].province).forEach((e) => {
          this.choosedProvince.push(e);
        });

        eval(curCaseList[0].enrollmentCategory).forEach((e) => {
          this.choosedEnrollType.push(e);
        });

        eval(curCaseList[0].otherConditions).forEach((e) => {
          this.choosedOther.push(e);
        });
        this.confirmAll();
      }
      this.caseshow = true;
    },
    //获得指定学生的信息
    getOneStu(stuId) {
      studentInfo({ studentId: stuId }).then((res) => {
        if (res.data.code == 200) {
          this.resetMajor(); //清空显示tag
          this.caseRecords = []; //清空显示方案
          this.curShowRisk = [0, 0, 0]; //清空冲稳保条数

          // console.log("当前学生总信息", res.data.data);

          this.curStuInfo = res.data.data.studentInfo; //当前学生信息
          this.curCaseList = res.data.data.studentInfoIntentionSchemes; //当前学生的所有方案对应的筛选条件集合
          this.curRiskList = res.data.data.schemeRiskList; //当前学生对应的所有方案冲稳保数量信息集合

          // console.log("this.curStuInfo:", this.curStuInfo);
          // console.log("this.curCaseList:", this.curCaseList);
          // console.log("this.curRiskList:", this.curRiskList);
          this.curRiskList.forEach((e) => {
            //拿到学生的所有方案信息
            let caseobj = {
              id: e.schemeId,
              name: "方案" + (this.caseRecords.length + 1),
              riskList: e.riskRecordsCount,
            };
            this.caseRecords.push(caseobj);
          });

          //默认回显第一个方案的筛选条件和冲稳保数量
          this.reviewCase(this.curCaseList, this.curRiskList, 0);
        }
      });
    },
    //保存方案及方案对应筛选条件
    saveCaseAndCondition(data) {
      saveAndOptimize(data).then((res) => {
        console.log(res.data.data);
        // console.log("保存前this.curCaseList:", this.curCaseList);
        // console.log("保存前this.curRiskList:", this.curRiskList);
        if (res.data.code == 200) {
          let caseobj = {
            id: res.data.data.riskInfo.schemeId,
            name: "方案" + (this.caseRecords.length + 1),
            riskList: res.data.data.riskInfo.riskRecordsCount,
          };
          this.caseRecords.push(caseobj);
          this.curShowRisk = res.data.data.riskInfo.riskRecordsCount;

          this.curCaseList.push(res.data.data.studentInfoIntentionScheme); //更新当前学生的所有方案对应的筛选条件集合
          this.curRiskList.push(res.data.data.riskInfo); //更新当前学生对应的所有方案冲稳保数量信息集合
          // console.log("保存后this.curCaseList:", this.curCaseList);
          // console.log("保存后this.curRiskList:", this.curRiskList);
          this.reviewCase(
            //回显当前案件的筛选条件和冲稳保信息
            this.curCaseList,
            this.curRiskList,
            this.caseRecords.length - 1
          );
          this.$message.success("方案保存成功！");
        }
      });
    },
    //显示当前方案详情，以供优化
    updateCase(row) {
      // console.log("当前优化方案id:", row.id);
      this.curOpeCaseId = row.id;
      this.resetMajor(); //清空显示tag
      //回显当前方案的筛选条件和冲稳保数量
      let idx = 0;
      this.caseRecords.forEach((e) => {
        if (e.id == row.id) {
          idx = this.caseRecords.indexOf(e);
          this.$notify({
            title: "提示",
            message: "当前优化：" + e.name,
            type: "success",
          });
        }
      });
      // console.log("当前回显方案下标:", idx);
      this.reviewCase(this.curCaseList, this.curRiskList, idx);
      let data = {
        schemeId: row.id,
      };
      this.caseInfoLoad = true;
      schemeOptimize(data).then((res) => {
        this.caseInfoLoad = false;
        // console.log("当前方案id-" + row.id + ":", res.data.data);
        this.caseRecordsInfo = res.data.data;
      });

      this.caseRecordsInfoshow = true;
    },
    //删除整个方案
    deleteCase(row) {
      console.log("row:", row);
      console.log("删除前this.caseRecords:", this.caseRecords);
      this.$confirm("此操作将删除该方案下的所有志愿记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          schemeDelete({ schemeId: row.id }).then((res) => {
            if (res.data.code == 200) {
              //显示的方案信息要删
              this.caseRecords.forEach((e) => {
                if (e.id == row.id) {
                  this.caseRecords.splice(this.caseRecords.indexOf(e), 1);
                }
              });
              //储存的方案筛选条件信息要删
              this.curCaseList.forEach((e) => {
                if (e.id == row.id) {
                  this.curCaseList.splice(this.curCaseList.indexOf(e), 1);
                }
              });
              //储存的方案方案冲稳保信息要删
              this.curRiskList.forEach((e) => {
                if (e.schemeId == row.id) {
                  this.curRiskList.splice(this.curRiskList.indexOf(e), 1);
                }
              });

              console.log("删除后this.caseRecords:", this.caseRecords);
              console.log("删除后this.curCaseList:", this.curCaseList);
              console.log("删除后this.curRiskList:", this.curRiskList);

              this.curShowRisk = [0, 0, 0]; //清空冲稳保条数
              this.resetMajor(); //清空显示tag
              this.caseshow = true; //维持显示
              this.$notify({
                title: "成功",
                message: "删除方案成功！",
                type: "success",
              });
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //显示可添加的剩余方案志愿记录
    openaddcasediv(row) {
      this.curOpeCaseId = row.id;
      this.addcasedivshow = true;
      this.lastCaseInfoLoad = true;

      addNewRecord({ schemeId: row.id }).then((res) => {
        this.lastCaseInfoLoad = false;
        this.lastcaseRecordsInfo =
          res.data.data.length > 0 ? res.data.data : [];
      });
    },
    //添加方案志愿记录
    addCaseInfoRecord(row) {
      this.lastCaseInfoLoad = true;
      let ids = [row.id];
      newRecordSave({ schemeId: this.curOpeCaseId, recordIds: ids }).then(
        (res) => {
          this.lastCaseInfoLoad = false;
          if (res.data.code == 200) {
            //当前方案志愿记录增加
            this.caseRecordsInfo.push(row);
            //当前剩余可添加方案记录减少
            this.lastcaseRecordsInfo.splice(
              this.lastcaseRecordsInfo.indexOf(row),
              1
            );
            this.$notify({
              title: "成功",
              message: "添加方案志愿记录成功!",
              type: "success",
            });
          }
        }
      );
    },
    //删除方案志愿记录
    deleteCaseInfo(row) {
      console.log("志愿记录row：", row);

      this.$confirm("此操作将删除该志愿记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let data = {
            schemeId: this.curOpeCaseId,
            recordId: row.id,
          };
          let delRisk = row.risk;
          console.log("delRisk:", delRisk);
          recordDelete(data).then((res) => {
            if (res.data.code == 200) {
              //表格显示的方案志愿记录信息要删
              this.caseRecordsInfo.forEach((e) => {
                if (e.id == row.id) {
                  this.caseRecordsInfo.splice(
                    this.caseRecordsInfo.indexOf(e),
                    1
                  );
                }
              });
              //同步筛选条件显示的冲稳保信息以及方案列表显示的冲稳保信息
              if (delRisk == "冲") {
                let x = this.curShowRisk[0];
                this.curShowRisk.splice(0, 1, x - 1);
                this.caseRecords.forEach((e) => {
                  if (e.id == this.curOpeCaseId) {
                    e.riskList.splice(0, 1, x - 1);
                  }
                });
              } else if (delRisk == "稳") {
                let x = this.curShowRisk[1];
                this.curShowRisk.splice(1, 1, x - 1);
                this.caseRecords.forEach((e) => {
                  if (e.id == this.curOpeCaseId) {
                    e.riskList.splice(1, 1, x - 1);
                  }
                });
              } else if (delRisk == "保") {
                let x = this.curShowRisk[2];
                this.curShowRisk.splice(2, 1, x - 1);
                this.caseRecords.forEach((e) => {
                  if (e.id == this.curOpeCaseId) {
                    e.riskList.splice(2, 1, x - 1);
                  }
                });
              }

              console.log("删除后的this.curShowRisk：", this.curShowRisk);
              this.$notify({
                title: "成功",
                message: "删除志愿记录成功！",
                type: "success",
              });
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //调整方案志愿记录位次提示
    changeOrderAlert(row) {
      this.curOrder = row.ranking;
      this.$notify({
        title: "成功",
        message: "正在调整位次...",
        type: "info",
      });
    },
    //调整方案志愿记录位次
    changeOrder(row) {
      if (this.newOrder == "") {
        this.$message({
          message: "调整新位次为空！",
          type: "warning",
        });
      } else {
        this.caseInfoLoad = true;
        schemeOptimize({
          schemeId: this.curOpeCaseId,
          recordId: row.id,
          recordNewRank: this.newOrder,
          isOrder: true,
        }).then((res) => {
          if (res.data.code == 200) {
            this.caseRecordsInfo = res.data.data;
            this.caseInfoLoad = false;
            this.newOrder = "";
            this.$notify({
              title: "成功",
              message: "调整位次成功！",
              type: "info",
            });
          }
        });
      }
      this.$refs.closePopover.click();
    },
    //切换学生信息
    chooseStu(row, event, column) {
      this.getOneStu(row.id);
      this.$message.success({
        dangerouslyUseHTMLString: true, //重点代码
        message:
          "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;切换至" +
          row.name +
          "方案！<br/>(当前显示第一个方案信息)",
      });
      // console.log("row:", row);
      // console.log("event:", event);
      // console.log("column:", column);
    },
    //关闭tag时，让多选框同步取消选中
    handleCloseTag(tag) {
      this.tags.splice(this.tags.indexOf(tag), 1);

      // console.log("删除的tag：", tag);
      this.choosedEngineeringSet.delete(tag.name);
      this.choosedPhilosophySet.delete(tag.name);
      this.choosedEconomicsSet.delete(tag.name);
      this.choosedLawSet.delete(tag.name);
      this.choosedTeachSet.delete(tag.name);
      this.choosedLiteratureSet.delete(tag.name);

      this.choosedCollegeLeveSet.delete(tag.name);
      this.choosedCollegeHoldTypeSet.delete(tag.name);
      this.choosedProvinceSet.delete(tag.name);
      this.choosedEnrollTypeSet.delete(tag.name);
      this.choosedOtherSet.delete(tag.name);

      if (this.choosedEngineering.indexOf(tag.name) != -1)
        this.choosedEngineering.splice(
          this.choosedEngineering.indexOf(tag.name),
          1
        );
      if (this.choosedPhilosophy.indexOf(tag.name) != -1)
        this.choosedPhilosophy.splice(
          this.choosedPhilosophy.indexOf(tag.name),
          1
        );
      if (this.choosedEconomics.indexOf(tag.name) != -1)
        this.choosedEconomics.splice(
          this.choosedEconomics.indexOf(tag.name),
          1
        );
      if (this.choosedLaw.indexOf(tag.name) != -1)
        this.choosedLaw.splice(this.choosedLaw.indexOf(tag.name), 1);
      if (this.choosedTeach.indexOf(tag.name) != -1)
        this.choosedTeach.splice(this.choosedTeach.indexOf(tag.name), 1);
      if (this.choosedLiterature.indexOf(tag.name) != -1)
        this.choosedLiterature.splice(
          this.choosedLiterature.indexOf(tag.name),
          1
        );

      if (this.choosedCollegeLeve.indexOf(tag.name) != -1)
        this.choosedCollegeLeve.splice(
          this.choosedCollegeLeve.indexOf(tag.name),
          1
        );
      if (this.choosedCollegeHoldType.indexOf(tag.name) != -1)
        this.choosedCollegeHoldType.splice(
          this.choosedCollegeHoldType.indexOf(tag.name),
          1
        );
      if (this.choosedProvince.indexOf(tag.name) != -1)
        this.choosedProvince.splice(this.choosedProvince.indexOf(tag.name), 1);
      if (this.choosedEnrollType.indexOf(tag.name) != -1)
        this.choosedEnrollType.splice(
          this.choosedEnrollType.indexOf(tag.name),
          1
        );
      if (this.choosedOther.indexOf(tag.name) != -1)
        this.choosedOther.splice(this.choosedOther.indexOf(tag.name), 1);
    },
    //筛选条件对话框打开
    openconditiondiv() {
      this.conditiondivshow = true;
    },
    //筛选条件对话框关闭
    handleClose() {
      this.conditiondivshow = false;
    },

    //选择多选框选项时，让tag同步生成
    confirmAll() {
      this.majorConfirm();
      this.collegeConfirm();
      this.enrollConfirm();
      this.otherConfirm();
    },
    majorConfirm() {
      this.choosedEngineering.forEach((e) => {
        if (!this.choosedEngineeringSet.has(e)) {
          this.choosedEngineeringSet.add(e);
          let tag = {
            name: e,
            type: "",
          };
          this.tags.push(tag);
        }
      });

      this.choosedPhilosophy.forEach((e) => {
        if (!this.choosedPhilosophySet.has(e)) {
          this.choosedPhilosophySet.add(e);
          let tag = {
            name: e,
            type: "",
          };
          this.tags.push(tag);
        }
      });

      this.choosedEconomics.forEach((e) => {
        if (!this.choosedEconomicsSet.has(e)) {
          this.choosedEconomicsSet.add(e);
          let tag = {
            name: e,
            type: "",
          };
          this.tags.push(tag);
        }
      });

      this.choosedLaw.forEach((e) => {
        if (!this.choosedLawSet.has(e)) {
          this.choosedLawSet.add(e);
          let tag = {
            name: e,
            type: "",
          };
          this.tags.push(tag);
        }
      });

      this.choosedTeach.forEach((e) => {
        if (!this.choosedTeachSet.has(e)) {
          this.choosedTeachSet.add(e);
          let tag = {
            name: e,
            type: "",
          };
          this.tags.push(tag);
        }
      });

      this.choosedLiterature.forEach((e) => {
        if (!this.choosedLiteratureSet.has(e)) {
          this.choosedLiteratureSet.add(e);
          let tag = {
            name: e,
            type: "",
          };
          this.tags.push(tag);
        }
      });
      this.conditiondivshow = false;
    },
    //统一在这清除tag
    resetMajor() {
      // this.caseRecordsInfoshow = false;
      // this.caseshow = false;

      this.tags = [];

      //取消全选状态
      this.engineeringCheckAll = false;
      this.philosophyCheckAll = false;
      this.economicsCheckAll = false;
      this.lawCheckAll = false;
      this.teachCheckAll = false;
      this.literatureCheckAll = false;

      this.choosedEngineeringSet.clear();
      this.choosedPhilosophySet.clear();
      this.choosedEconomicsSet.clear();
      this.choosedLawSet.clear();
      this.choosedTeachSet.clear();
      this.choosedLiteratureSet.clear();

      this.choosedCollegeLeveSet.clear();
      this.choosedCollegeHoldTypeSet.clear();
      this.choosedProvinceSet.clear();

      this.choosedEnrollTypeSet.clear();
      this.choosedOtherSet.clear();

      this.choosedEngineering = [];
      this.choosedPhilosophy = [];
      this.choosedEconomics = [];
      this.choosedLaw = [];
      this.choosedTeach = [];
      this.choosedLiterature = [];

      this.choosedCollegeLeve = [];
      this.choosedCollegeHoldType = [];
      this.choosedProvince = [];

      this.choosedEnrollType = [];
      this.choosedOther = [];
    },
    collegeConfirm() {
      this.choosedCollegeLeve.forEach((e) => {
        if (!this.choosedCollegeLeveSet.has(e)) {
          this.choosedCollegeLeveSet.add(e);
          let tag = {
            name: e,
            type: "success",
          };
          this.tags.push(tag);
        }
      });
      this.choosedCollegeHoldType.forEach((e) => {
        if (!this.choosedCollegeHoldTypeSet.has(e)) {
          this.choosedCollegeHoldTypeSet.add(e);
          let tag = {
            name: e,
            type: "success",
          };
          this.tags.push(tag);
        }
      });
      this.choosedProvince.forEach((e) => {
        if (!this.choosedProvinceSet.has(e)) {
          this.choosedProvinceSet.add(e);
          let tag = {
            name: e,
            type: "success",
          };
          this.tags.push(tag);
        }
      });
    },
    // resetCollege() {
    //   this.choosedCollegeLeve = [];
    //   this.choosedCollegeHoldType = [];
    //   this.choosedProvince = [];
    // },
    enrollConfirm() {
      // console.log("this.choosedEnrollType:", this.choosedEnrollType);
      this.choosedEnrollType.forEach((e) => {
        if (!this.choosedEnrollTypeSet.has(e)) {
          this.choosedEnrollTypeSet.add(e);
          let tag = {
            name: e,
            type: "info",
          };
          this.tags.push(tag);
        }
      });
    },
    // resetEnroll() {
    //   this.choosedEnrollType = [];
    // },
    otherConfirm() {
      // console.log("this.choosedOther:", this.choosedOther);
      this.choosedOther.forEach((e) => {
        if (!this.choosedOtherSet.has(e)) {
          this.choosedOtherSet.add(e);
          let tag = {
            name: e,
            type: "warning",
          };
          this.tags.push(tag);
        }
      });
    },
    resetOther() {
      this.choosedOther = [];
    },
    //工学多选框全选
    handleEngineeringAll(val) {
      this.choosedEngineering = val ? this.engineeringList : [];
      // this.majorConfirm();
    },
    //哲学多选框全选
    handlePhilosophyAll(val) {
      this.choosedPhilosophy = val ? this.philosophyList : [];
      // this.majorConfirm();
    },
    //经济学多选框全选
    handleEconomicsAll(val) {
      this.choosedEconomics = val ? this.economicsList : [];
      // this.majorConfirm();
    },
    //法学多选框全选
    handleLawAll(val) {
      this.choosedLaw = val ? this.lawList : [];
      // this.majorConfirm();
    },
    //教育学多选框全选
    handleTeachAll(val) {
      this.choosedTeach = val ? this.teachList : [];
      // this.majorConfirm();
    },
    //文学多选框全选
    handleLiteratureAll(val) {
      this.choosedLiterature = val ? this.literatureList : [];
      // this.majorConfirm();
    },
    fun() {
      this.$notify({
        title: "成功",
        message: "新增方案！",
        type: "success",
      });
    },
    handleChange(diffScore) {
      console.log(diffScore);
    },
    searchAndSave() {
      if (this.tags.length > 0) {
        this.caseRecordsInfoshow = false;
        this.caseshow = true;

        let engi = [];
        this.choosedEngineeringSet.forEach((e) => {
          engi.push(e);
        });
        // console.log("已选工学专业：", engi);
        let phi = [];
        this.choosedPhilosophySet.forEach((e) => {
          phi.push(e);
        });
        // console.log("已选哲学专业：", phi);
        let eco = [];
        this.choosedEconomicsSet.forEach((e) => {
          eco.push(e);
        });
        // console.log("已选经济学专业：", eco);
        let law = [];
        this.choosedLawSet.forEach((e) => {
          law.push(e);
        });
        // console.log("已选法学专业：", law);
        let teach = [];
        this.choosedTeachSet.forEach((e) => {
          teach.push(e);
        });
        // console.log("已选教育学专业：", teach);
        let lit = [];
        this.choosedLiteratureSet.forEach((e) => {
          lit.push(e);
        });
        // console.log("已选文学专业：", lit);
        let lev = [];
        this.choosedCollegeLeveSet.forEach((e) => {
          lev.push(e);
        });
        // console.log("已选院校层次：", lev);
        let hold = [];
        this.choosedCollegeHoldTypeSet.forEach((e) => {
          hold.push(e);
        });
        // console.log("已选办学性质：", hold);
        let prov = [];
        this.choosedProvinceSet.forEach((e) => {
          prov.push(e);
        });
        // console.log("已选所在省份：", prov);
        let enro = [];
        this.choosedEnrollTypeSet.forEach((e) => {
          enro.push(e);
        });
        // console.log("已选招生类别：", enro);
        let oth = [];
        this.choosedOtherSet.forEach((e) => {
          oth.push(e);
        });
        let score = this.diffScore;
        // console.log("已选其他筛选：", oth);
        let majorConditionMap = new Map();

        let filterCondition = {
          scoreBias: this.diffScore,
          majorCondition: {
            engineeringList: engi, //工学
            philosophyList: phi, //哲学
            economicsList: eco, //经济学
            lawList: law, //法学
            teachList: teach, //教育学
            literatureList: lit, //文学
          },
          collegeLevelCondition: lev, //院校层次
          collegeHoldCondition: hold, //办学性质
          provinceCondition: prov, //省份
          enrollCategoryCondition: enro, //招生类别
          otherCondition: oth, //其他筛选
        };
        console.log("filterCondition:", filterCondition);
        this.saveCaseAndCondition(filterCondition);
      } else {
        this.$message.warning("筛选条件为空！");
      }
    },
    addCase() {
      this.$notify({
        title: "成功",
        message: "添加方案！",
        type: "success",
      });
    },
    exportCase(row) {
      // console.log("row:",row);
      exportExcel({ schemeId: row.id })
        .then((res) => {
          if (res.data.code != 500) {
            console.log(res.data);
            let link = document.createElement("a");
            let blob = new Blob([res.data], {
              type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
            });
            link.style.display = "none";
            link.href = URL.createObjectURL(blob);
            // link.download = res.headers["content-disposition"]; //下载后文件名
            // let name = link.download.split(".")[0];
            link.download =
              this.curStuInfo.name +
              "_志愿报考方案" +
              (this.caseRecords.indexOf(row) + 1); //下载的文件名
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
          }
        })
        .catch((error) => {
          this.$message.error("下载失败");
        });
    },
  },
};
</script>
<style scoped>
.zdy {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}

.title {
  font-size: 22px;
  font-weight: 550;
  margin: 15px;
}

.conditiondiv1,
.conditiondiv2,
.conditiondiv3,
.conditiondiv4 {
  width: 410px;
  height: 360px;
  margin-left: 3%;
  /* margin-top: 5%; */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}

.total {
  font-size: 0;
  /*让left、right两div宽度加起来完全100%而不换行*/
  position: relative;
  margin: 0 auto;
  padding: 0;
  width: 100%;
  height: 100%;
  /* background-color: floralwhite; */
}

.left {
  vertical-align: middle;
  /*解决left和right盒子高度不对齐的问题*/
  font-size: 18px;
  margin: 0;
  padding: 0;
  display: inline-block;
  width: 10%;
  height: 100%;
  /* background-color: antiquewhite; */
  border-right: 1px solid #a87979;
  border-right-width: 2px;
}

.ltop {
  border: 1px solid;
  height: 4%;
}

.lbottom {
  margin-top: 0.5%;
  border: 1px solid;
  height: 95.5%;
}

.right {
  position: relative;
  vertical-align: middle;
  /*解决left和right盒子高度不对齐的问题*/
  text-align: left;
  font-size: 18px;
  margin: 0;
  padding: 0;
  display: inline-block;
  width: 89.5%;
  height: 100%;
  /* background-color: aqua; */
}

.rtop {
  margin-left: 6%;
  margin-top: 2%;
}

.topcontent,
.bottomcontent {
  display: flex;
  justify-content: center;
  align-items: center;
}

.midcontent {
  margin: 0 auto;
  width: 90%;
  margin-top: 15px;
  display: flex;
  justify-content: normal;
  align-items: center;
}

.hr-more1 {
  display: block;
  z-index: 99;
  height: 20px;
  width: 130px;
  position: relative;
  left: 4.2%;
  top: -15px;
  font: normal 1.2em/20px 微软雅黑;
  font-size: 30px;
  font-weight: 600;
  text-align: center;
  border-radius: 4px;
  background-color: #fff;
}

.hr-more2 {
  z-index: 99;
  height: 20px;
  width: 130px;
  position: relative;
  left: 10%;
  top: -22px;
  font: normal 1.2em/20px 微软雅黑;
  font-size: 30px;
  font-weight: 600;
  vertical-align: middle;
  text-align: center;
  border-radius: 4px;
  background-color: #fff;
}

.hr-more3 {
  z-index: 99;
  height: 20px;
  width: 130px;
  position: relative;
  left: 4.9%;
  top: -15px;
  font: normal 1.2em/20px 微软雅黑;
  font-size: 30px;
  font-weight: 600;
  vertical-align: middle;
  text-align: center;
  border-radius: 4px;
  background-color: #fff;
}

.rmid1 {
  margin-left: 6%;
  margin-right: 6%;
  margin-top: 3%;
  border: 1px solid yellow;
  border-width: 4px;
  height: 25%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}

.rmid2 {
  padding-left: 10px;
  margin-left: 6%;
  margin-right: 6%;
  height: 17.8%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}

.rbottom {
  padding-left: 10px;
  margin-left: 6%;
  margin-right: 6%;
  margin-top: 2.5%;
  border-width: 4px;
  height: 36%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}

.right > span {
  display: inline-block;
}
</style>
<style>
div {
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* 页面不留间隙，且无内容高度充满 */
body {
  height: 100%;
  margin: 0px;
}

.el-checkbox__label {
  display: inline-block;
}

.el-descriptions :not(.is-bordered) .el-descriptions-item__cell {
  padding: 0;
}

.el-tag {
  margin-left: 10px;
  margin-bottom: 5px;
}

.el-descriptions-item__container .el-descriptions-item__content,
.el-descriptions-item__container .el-descriptions-item__label {
  display: block;
}

.el-dialog {
  width: 1700px !important;
}
.el-descriptions-row {
  height: 40px;
}
</style>

